using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.OleDb;
using DTO;

namespace DAO
{
    public class QuyDinhDAO:DataProvider
    {
        public DataTable LayBang()
        {
            string sql = "select * from QuyDinh";
            DataTable dt = DocBang(sql);
            return dt;
        }

        public void Sua(QuyDinhDTO qddto)
        {
            OleDbConnection cn = new OleDbConnection();
            cn = KetNoi();
            string sql = "Update QuyDinh Set  GiaTri = ? Where Ma = ?";
            OleDbCommand cmd = new OleDbCommand(sql, cn);

            cmd.Parameters.Add("@GiaTri", OleDbType.Double);
            cmd.Parameters.Add("@Ma", OleDbType.Integer);

            cmd.Parameters["@GiaTri"].Value = qddto.GiaTri;
            cmd.Parameters["@Ma"].Value = qddto.Ma;
           
            cmd.ExecuteNonQuery();
            cn.Close();
        }
    }
}
